/* CQFS Engine
 * Copyright (c) 2006 Blazing Games Inc. All Rights Reserved
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; 
 * version 2.1 of the License.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
package com.blazinggames.cqfs.data;

/**
 * A generic interface used by resource manager classes that allow the 
 * creation of game resources. This allows much more flexibility in 
 * managing resource information, as the resource manager can hold 
 * information about how to get a resource, and when that resource is 
 * needed can then call the resources factory to create the resource with 
 * the provided creation information. My factories are potentially green ones,
 * meaning that if the class supports re-using objects then the object is 
 * returned to the factory where the object gets re-used next time a new 
 * instance of that object is needed. This allows for faster object creation
 * (as you are just filling out the object details, not creating a new object).
 * 
 * @author Billy D. Spelchan
 * @version 1.0
 */
public interface Factory
{
	/**
	 * Creates an object (the type of factory determines the type of object 
	 * created) using the specified parameters. Most factories will load the 
	 * object from somewhere, but certainly some type of dynamic generation of
	 * an object is also possible.
	 * 
	 * @param parameters information used to create the object
	 * @return the object (as a generic object - needs to be cast)
	 */
	public Object create(String parameters);
	
	/**
	 * Some objects can be re-used. If this is the case, the object is cleaned
	 * up and when a new object is needed, recycled objects are used. If 
	 * Object re-use is not possible, the object is just deleted.
	 * 
	 * @param o object for recycling (should be same type as factory produces)
	 */
	public void recycle(Object o);
}
